import  calendar

year = int(input())
month = int(input())
day =  int(input())

days = calendar.monthrange(year, month)[1]

result=days-day
print(result)
   
   